import axios from '@/utils/request'

/**
 * 获取所有权限点
 * @returns
 */
export function getPermissionList() {
  return axios({
    url: '/sys/permission'
  })
}

// 添加权限
export function addPermission(data) {
  return axios({
    method: 'post',
    url: '/sys/permission',
    data
  })
}

/**
 * 根据id获取权限详情（查看编辑）
 * @param {*} id
 */
export function getPermissionDetail(id) {
  return axios({
    method: 'get',
    url: `/sys/permission/${id}`
  })
}

/**
 * 点击确定修改权限
 * @param {*} data
 */
export function updatePermission(data) {
  return axios({
    method: 'put',
    url: `/sys/permission/${data.id}`,
    data
  })
}

/**
 * 删除权限
 * @param {*} id
 */
export function delPermission(id) {
  return axios({
    method: 'delete',
    url: `/sys/permission/${id}`
  })
}
